package com.lkxicy.wos.mapper;

import com.lkxicy.wos.pojo.entity.SalaryPayment;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.lkxicy.wos.pojo.entity.SalaryReword;
import com.lkxicy.wos.pojo.vo.SalaryRecord;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.Date;
import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author lkxicy
 * @since 2020-12-02
 */
public interface SalaryPaymentMapper extends BaseMapper<SalaryPayment> {

    @Select("SELECT staff.staffNumber,staff.`name`,staff.department,p.payTime,p.normalSalary,p.actualSalary\n" +
            "FROM staff,salaryPayment p\n" +
            "WHERE staff.staffNumber=p.staffNumber\n" +
            "AND staff.staffNumber=#{staffNumber}")
    public List<SalaryRecord> findOneAllRecord(@Param("staffNumber") String staffNumber);

    @Select("SELECT * \n" +
            "FROM salaryPayment\n" +
            "WHERE staffNumber=#{staffNumber}\n" +
            "AND MONTH(payTime)=MONTH(#{effectTime})")
    public SalaryPayment findOneIsPaied(@Param("staffNumber") String staffNumber,
                                        @Param("effectTime") Date effectTime);



}
